<include file="Public/head"/>
<css href="__PUBLIC__/qwadmin/css/bootstrap-datetimepicker.min.css"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                     <div class="cf">
                            <form class="form-inline" action="" method="get">
                                
                                <label class="inline">请选择时间段：</label>
                                <input type="text" class="form-control datetimeStart" readonly  value="{$dateS|date='Y-m-d',###}"/>
                                &nbsp;-&nbsp;
                                <input type="text" class="form-control datetimeEnd" readonly  value="{$dateE|date='Y-m-d',###}"/>
                                
                                <label class="inline">请输入驾校名称</label>
                                <input type="text" class="form-control scname"   name='scname' value="{:I('scname')}"/>
							
                                
                                
                                <button type="button" onclick="sou()" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    搜索
                                </button>
                               <button type="button"  class="btn btn-purple btn-sm pri" onclick='pri();'>
	                                    <span class="ace-icon fa fa-print icon-on-right bigger-110"></span>
	                                   		 打印全部
	                    	</button>
	                    	<button type="button"  class="btn btn-purple btn-sm pri" onclick='preview(1);'>
	                                    <span class="ace-icon fa fa-print icon-on-right bigger-110"></span>
	                                   		 打印当前页
	                    	</button>
                            </form>
                        </div>
                        <!--startprint1-->
                        <h2 class=" text-center">财务总报表</h2>
                        <h5>时&nbsp;&nbsp;间&nbsp;&nbsp;段：{$dateS|date='Y-m-d',###}&nbsp;至&nbsp;{$dateE|date='Y-m-d',###}</h5>
                    <div class="space-4"></div>
                      <table class="table table-striped table-bordered" >
                            <thead>
                            <tr>
                            	
                            	<th class="center">驾校名称</th>
                                <th class="center">科目</th>
                                <th class="center">金额（单位：元）</th>
                                <th class="center">操作</th>
                            </tr>
                            </thead>
                            <tbody>

               					<?php if(!empty($info)) { ?>
               					<volist name='info' id='v'>
                                 <tr>
                                 	
                                 	<td rowspan='3' class='center'>
                                 		{$v['name']}<br/>
                                 		（驾校标识：{$v['uid']}）
                                 	</td>
                                    <td class="center">预约学车</td>
 									<td class="center">
 									<?php if($v['mTotalP']){ ?>
 									{$v['mTotalP']}
 									<?php }else{?>
 									/
 									<?php  }?>
 									</td>
                                    <td class="center"><a href="<?php echo U('Record/details',array('pay_type'=>1,'dateS'=>$dateS,'dateE'=>$dateE,'date'=>$date,'type'=>1,'id'=>$v['uid'],'name'=>$v['name']));?>"><i
                                            class="ace-icon fa fa-pencil bigger-100"></i>详情</a>
                                     </td>
                                </tr>
                               
                                <tr>
                                	
                                    <td class="center">在线报名</td>
 									<td class="center">
 									
	 									<?php if($v['sTotalP']){ ?>
	 									{$v['sTotalP']}
	 									<?php }else{?>
	 									/
	 									<?php  }?>
 									</td>
                                    <td class="center"><a href="<?php echo U('Record/details',array('pay_type'=>1,'dateS'=>$dateS,'dateE'=>$dateE,'date'=>$date,'type'=>2,'id'=>$v['uid'],'name'=>$v['name']));?>"><i
                                            class="ace-icon fa fa-pencil bigger-100"></i>详情</a>
                                     </td>
                                </tr>
                                <tr>
                                    <td colspan ='4' align="right">合计：{$v['total']} 元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                    
                                </tr>
                                </volist>
                                <?php  }else{ ?>
                                	<tr>
                                	 	<td colspan ='4' align="center">本月未有资金收入！</td>
                                	 </tr>
                                
                                <?php }?>
                            </tbody>
                        </table>
                        <!--endprint1-->
                    {$page}
                    
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<include file="Public/footer"/>

</div><!-- /.main-container -->
<script src="__PUBLIC__/qwadmin/js/jquery-1.9.1.min.js"></script>
<script src="__PUBLIC__/qwadmin/js/bootstrap-datetimepicker.js"></script>
<script src="__PUBLIC__/qwadmin/js/bootstrap-datetimepicker.zh-CN.js"></script>
<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
/*打印 当前页*/
function preview(oper) {
	if (oper < 10) { 
	bdhtml = window.document.body.innerHTML;//获取当前页的html代码 
	sprnstr = "<!--startprint" + oper + "-->";//设置打印开始区域 
	eprnstr = "<!--endprint" + oper + "-->";//设置打印结束区域 
	prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html 
	prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//从结束代码向前取html 
	window.document.body.innerHTML = prnhtml; 
	window.print(); 
	window.document.body.innerHTML = bdhtml; 
	} else { 
	window.print(); 
	}
}
/*打印 全部*/
function pri(){
	 var dateS = $('.datetimeStart').val();
	 var dateE = $('.datetimeEnd').val();
 	 var scname = $('.scname').val();
	 var param = '/type/2';
 if(dateS){
     param += '/dateS/'+dateS;
     if(dateE ==''){
     	alert('请选择结束时间');
     	return false;
     }else{
     	param += '/dateE/'+dateE;
     }
 }
 if(scname){
     param += '/scname/'+scname; 
 }

 location.href="__APP__/Admin/AllRecord/index"+param+".html";
}

$(".datetimeStart").datetimepicker({
    format: 'yyyy-mm-dd',
    minView:'month',
    language: 'zh-CN',
    autoclose:true
}).on("click",function(){
    $(".datetimeStart").datetimepicker("setEndDate",$(".datetimeEnd").val())
});

$(".datetimeEnd").datetimepicker({
    format: 'yyyy-mm-dd',
    minView:'month',
    language: 'zh-CN',
    autoclose:true
}).on("click",function(){
    $(".datetimeEnd").datetimepicker("setStartDate",$(".datetimeStart").val())
});

function sou(){
	 var dateS = $('.datetimeStart').val();
	    var dateE = $('.datetimeEnd').val();
    var scname = $('.scname').val();

    var param = '';
    if(dateS){
        param += '/dateS/'+dateS;
        if(dateE ==''){
        	alert('请选择结束时间');
        	return false;
        }else{
        	param += '/dateE/'+dateE;
        }
    }
    if(scname){
        param += '/scname/'+scname; 
    }

    location.href="__APP__/Admin/AllRecord/index"+param+".html";
}





</script>
</body>
</html>
